package net.csdn.business.notify.handler.utils;

import com.aliyun.dm20151123.Client;
import com.aliyun.teaopenapi.models.Config;
import lombok.Data;


/**
 * @ClassName EmailPushConfigClient
 * @Description TODO
 * @Author zhangyl
 * @Date 2023/12/4 11:27
 */
@Data
public class EmailPushConfigClient {
    private Client client;

    private EmailPushConfigClient(String accessKeyId, String accessKeySecret) throws Exception {
        Config config = new Config()
                .setAccessKeyId(accessKeyId)
                .setAccessKeySecret(accessKeySecret);
        config.endpoint = "dm.aliyuncs.com";
        client = new Client(config);
    }

    private volatile static EmailPushConfigClient instance = null;

    public static EmailPushConfigClient getInstance(String accessKeyId, String accessKeySecret) throws Exception {
        if (instance == null) {
            synchronized (EmailPushConfigClient.class) {
                if (instance == null) {
                    instance = new EmailPushConfigClient(accessKeyId, accessKeySecret);
                }
            }
        }
        return instance;
    }
}